#include <string>

#include "projects.h"
#include "util.h"
#include "query.h"

using namespace std;

extern int MemberIDGlobalVariable;

Projects::Projects()
{
///create query to retrieve all the projects of the user currently logged in
string GetProjectsQuery="SELECT ProjectName FROM Projects Left Join ProjectUsers ON ProjectUsers.ProjectID=Projects.ProjectKey WHERE UserID=";
GetProjectsQuery+=ConvertIntToString(MemberIDGlobalVariable);

///Execute query
GetProjects.SetQueryString(GetProjectsQuery);
GetProjects.Execute();
}

Projects::~Projects()
{
}

int Projects::GetProjectsNumbered(string &Projects)
{
///Get projects in a numbered way by default since class is numberedset
Projects=GetProjects.GetReturnElementsNumbered();
return GetProjects.GetReturnElementsCount();
}

string Projects::GetProjectNameAtPosition(int ProjectPosition)
{
///Get specific project at index k
	return GetProjects.GetReturnElementAtPosition(ProjectPosition);
}

int Projects::GetProjectsUnnumbered(std::string &Projects)
{

///Get projects in an unnumbered way
Projects=GetProjects.GetReturnElementsUnnumbered();
return GetProjects.GetReturnElementsCount();
}
